function g(t, c, f, a) {
  switch (t) {
    case 0:
      return (c & f) ^ (~c & a);
    case 1:
      return c ^ f ^ a;
    case 2:
      return (c & f) ^ (c & a) ^ (f & a);
    case 3:
      return c ^ f ^ a;
  }
}
function s(t, c) {
  return (t << c) | (t >>> (32 - c));
}
function w(t) {
  const c = [1518500249, 1859775393, 2400959708, 3395469782],
    f = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
  if (typeof t == 'string') {
    const e = decodeURIComponent(encodeURIComponent(t));
    t = [];
    for (let n = 0; n < e.length; ++n) t.push(e.charCodeAt(n));
  } else Array.isArray(t) || (t = Array.prototype.slice.call(t));
  t.push(128);
  const a = t.length / 4 + 2,
    x = Math.ceil(a / 16),
    l = new Array(x);
  for (let e = 0; e < x; ++e) {
    const n = new Uint32Array(16);
    for (let o = 0; o < 16; ++o)
      n[o] =
        (t[e * 64 + o * 4] << 24) |
        (t[e * 64 + o * 4 + 1] << 16) |
        (t[e * 64 + o * 4 + 2] << 8) |
        t[e * 64 + o * 4 + 3];
    l[e] = n;
  }
  (l[x - 1][14] = ((t.length - 1) * 8) / Math.pow(2, 32)),
    (l[x - 1][14] = Math.floor(l[x - 1][14])),
    (l[x - 1][15] = ((t.length - 1) * 8) & 4294967295);
  for (let e = 0; e < x; ++e) {
    const n = new Uint32Array(80);
    for (let r = 0; r < 16; ++r) n[r] = l[e][r];
    for (let r = 16; r < 80; ++r)
      n[r] = s(n[r - 3] ^ n[r - 8] ^ n[r - 14] ^ n[r - 16], 1);
    let o = f[0],
      i = f[1],
      h = f[2],
      d = f[3],
      u = f[4];
    for (let r = 0; r < 80; ++r) {
      const p = Math.floor(r / 20),
        A = (s(o, 5) + g(p, i, h, d) + u + c[p] + n[r]) >>> 0;
      (u = d), (d = h), (h = s(i, 30) >>> 0), (i = o), (o = A);
    }
    (f[0] = (f[0] + o) >>> 0),
      (f[1] = (f[1] + i) >>> 0),
      (f[2] = (f[2] + h) >>> 0),
      (f[3] = (f[3] + d) >>> 0),
      (f[4] = (f[4] + u) >>> 0);
  }
  return [
    (f[0] >> 24) & 255,
    (f[0] >> 16) & 255,
    (f[0] >> 8) & 255,
    f[0] & 255,
    (f[1] >> 24) & 255,
    (f[1] >> 16) & 255,
    (f[1] >> 8) & 255,
    f[1] & 255,
    (f[2] >> 24) & 255,
    (f[2] >> 16) & 255,
    (f[2] >> 8) & 255,
    f[2] & 255,
    (f[3] >> 24) & 255,
    (f[3] >> 16) & 255,
    (f[3] >> 8) & 255,
    f[3] & 255,
    (f[4] >> 24) & 255,
    (f[4] >> 16) & 255,
    (f[4] >> 8) & 255,
    f[4] & 255,
  ];
}
export { w as default };
